<?php
require 'db.php';
require 'function.php';
$admin1 = new Manager($link);
$id = $_GET['id'];

if (isset($_POST['submit'])){
    $admin = $_POST['admin'];
    $status = $_POST['status'];
    $password = $_POST['password'];
    $email = $_POST['email'];
    $phone = $_POST['phone'];
    if (!empty($admin) || !empty($status) || !empty($password) || !empty($email) || !empty($phone)){
    $query = $admin1->addAdmin($admin, $status,$password,$email,$phone);
    if ($query){
        header("Location:m_admin.php");
    }
    }else{
        echo "<script>alert('添加失败！');</script>";
        echo "<script>history.go(-1);</script>";
        header("Location:m_admin.php");
    }
}

require 'add.html';
?>